#!/usr/bin/env python
#coding=utf8

chance=0
the_file=open("passwd.txt")
the_passwd=the_file.read().strip("\n")

while True:
    attempt=input("please input you passwd:")
    if attempt != the_passwd:
        chance=chance+1
        if chance >=3:
            print("密码错误次数过多，程序结束")
            break
        print("密码错误，请重新输入:")
        continue
    else:
        print("passwd is true")
        print("程序结束")
        break